package com.wutianyi.favority;

import org.apache.commons.lang.RandomStringUtils;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;

public class FavorityTestUtils {
	private FavorityRepository repository;

	public FavorityTestUtils(FavorityRepository repository) {
		this.repository = repository;
	}

	public void deleteNode(Node node) {
		Transaction tx = repository.getGraphDb().beginTx();
		try {
			for (Relationship rs : node.getRelationships()) {
				rs.delete();
			}
			node.delete();
			tx.success();
		} finally {
			tx.finish();
		}
	}

	public static void main(String[] args) {
		for (int i = 0; i < 10; i++) {
			System.out.println(RandomStringUtils.randomAlphabetic(10));
		}
	}
}
